Release 10.1A: OpenEdge Development:
Progress 4GL Reference
ASC function
Converts a character expression representing a single character into the corresponding ASCII (or internal code page) integer value.
Syntax
expressionAn expression with a value of a single character that you want to convert to an ASCII (or internal code page) integer value. If
expressionis a constant, you must enclose it in quotation marks (" "). If the value ofexpressionis other than a single character, ASC returns the value -1.The values for
expressionare case sensitive. For example, ASC("a") returns a different value than ASC("A").target-codepageA character-string expression that evaluates to the name of a code page. The name that you specify must be a valid code page name available in the
DLC/convmap.cpfile (a binary file that contains all of the tables that Progress uses for character management). If you supply a non-valid name, the ASC function returns the value -1 and returns a runtime error. Before returning an integer value, the ASC function convertsexpressionfromsource-codepagetotarget-codepage. The returned integer value is relative totarget-codepage. If you do not specifytarget-codepage, the value returned is the code page identified with the Internal Code Page (-cpinternal) parameter.source-codepageA character-string expression that evaluates to the name of a code page. The name that you specify must be a valid code page name available in the
ExampleDLC/convmap.cpfile. If you supply a non-valid name, the ASC function returns the value -1. Thesource-codepagespecifies the name of the code page to whichexpressionis relative. The default value ofsource-codepageis the code page identified with the Internal Code Page (-cpinternal) parameter.The following procedure counts how many customers names begin with each of the letters, A-Z. It counts all other customers separately. The procedure uses the ASC function to translate a letter into an integer that it uses as an array subscript for counting.
Notes
- The ASC function returns the corresponding value in the specified character set. By default, the value of SESSION:CHARSET is iso8859-1. You can set a different internal code page by specifying the Internal Code Page (-cpinternal) parameter. For more information, see OpenEdge Development: Internationalizing Applications .
- The ASC function is double-byte enabled. If the
expressionargument yields a double-byte character, this function returns a value greater than 255 and less than 65535.See also
CHR function, CODEPAGE-CONVERT function, INTEGER function, SESSION system handle
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |